package com.yuyuan.blog.controller;


import com.yuyuan.blog.domain.dto.CommentDTO;
import com.yuyuan.blog.service.ICommentService;
import com.yuyuan.common.domain.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: kestrel
 * @Version:1.0
 * @Date: 2024/5/29
 */
@RestController
@RequestMapping("/blogService/comment")
public class CommentController {
    @Autowired
    private ICommentService commentService;

    //发布评论
    @PostMapping("/{blogId}/{targetId}")
    public Result comment(@RequestBody CommentDTO commentDTO , @PathVariable Long blogId, @PathVariable Long targetId){
        return commentService.comment(commentDTO,blogId, targetId);
    }

    //获取一个贴子的评论(分页)
    @GetMapping("/get/{blogId}/{startId}")
    public Result getPageComment(@PathVariable Long blogId, @PathVariable Long startId){
        return commentService.getPageComment(blogId,startId);
    }
}
